<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Module      :  Distribution.Simple.Program.Ld</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Copyright   :  Duncan Coutts 2009</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Maintainer  :  cabal-devel@haskell.org</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- This module provides an library interface to the @ld@ linker program.</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Distribution.Simple.Program.Ld</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-15"></span><span>    </span><span class="annot"><a href="Distribution.Simple.Program.Ld.html#combineObjectFiles"><span class="hs-identifier">combineObjectFiles</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Compat.Prelude.html"><span class="hs-identifier">Distribution.Compat.Prelude</span></a></span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Compiler.html"><span class="hs-identifier">Distribution.Simple.Compiler</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Distribution.Simple.Compiler.html#arResponseFilesSupported"><span class="hs-identifier">arResponseFilesSupported</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.LocalBuildInfo.html"><span class="hs-identifier">Distribution.Simple.LocalBuildInfo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Distribution.Types.LocalBuildInfo.html#LocalBuildInfo"><span class="hs-identifier">LocalBuildInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.ResponseFile.html"><span class="hs-identifier">Distribution.Simple.Program.ResponseFile</span></a></span><span>
</span><span id="line-24"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.ResponseFile.html#withResponseFile"><span class="hs-identifier">withResponseFile</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html"><span class="hs-identifier">Distribution.Simple.Program.Run</span></a></span><span>
</span><span id="line-26"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier">ProgramInvocation</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier">programInvocation</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#multiStageProgramInvocation"><span class="hs-identifier">multiStageProgramInvocation</span></a></span><span>
</span><span id="line-27"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#runProgramInvocation"><span class="hs-identifier">runProgramInvocation</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html"><span class="hs-identifier">Distribution.Simple.Program.Types</span></a></span><span>
</span><span id="line-29"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ConfiguredProgram"><span class="hs-identifier">ConfiguredProgram</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Setup.html"><span class="hs-identifier">Distribution.Simple.Setup</span></a></span><span>
</span><span id="line-31"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Distribution.Simple.Flag.html#fromFlagOrDefault"><span class="hs-identifier">fromFlagOrDefault</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Setup.html#configUseResponseFiles"><span class="hs-identifier">configUseResponseFiles</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Utils.html"><span class="hs-identifier">Distribution.Simple.Utils</span></a></span><span>
</span><span id="line-33"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Distribution.Simple.Utils.html#defaultTempFileOptions"><span class="hs-identifier">defaultTempFileOptions</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html"><span class="hs-identifier">Distribution.Verbosity</span></a></span><span>
</span><span id="line-35"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html#Verbosity"><span class="hs-identifier">Verbosity</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#"><span class="hs-identifier">System.Directory</span></a></span><span>
</span><span id="line-38"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#renameFile"><span class="hs-identifier">renameFile</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>
</span><span id="line-40"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator">(&lt;.&gt;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#takeDirectory"><span class="hs-identifier">takeDirectory</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-comment">-- | Call @ld -r@ to link a bunch of object files together.</span><span>
</span><span id="line-43"></span><span class="hs-comment">--</span><span>
</span><span id="line-44"></span><span class="annot"><a href="Distribution.Simple.Program.Ld.html#combineObjectFiles"><span class="hs-identifier hs-type">combineObjectFiles</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html#Verbosity"><span class="hs-identifier hs-type">Verbosity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Types.LocalBuildInfo.html#LocalBuildInfo"><span class="hs-identifier hs-type">LocalBuildInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ConfiguredProgram"><span class="hs-identifier hs-type">ConfiguredProgram</span></a></span><span>
</span><span id="line-45"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span id="combineObjectFiles"><span class="annot"><span class="annottext">combineObjectFiles :: Verbosity
-&gt; LocalBuildInfo
-&gt; ConfiguredProgram
-&gt; FilePath
-&gt; [FilePath]
-&gt; IO ()
</span><a href="Distribution.Simple.Program.Ld.html#combineObjectFiles"><span class="hs-identifier hs-var hs-var">combineObjectFiles</span></a></span></span><span> </span><span id="local-6989586621679710024"><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679710024"><span class="hs-identifier hs-var">verbosity</span></a></span></span><span> </span><span id="local-6989586621679710023"><span class="annot"><span class="annottext">LocalBuildInfo
</span><a href="#local-6989586621679710023"><span class="hs-identifier hs-var">lbi</span></a></span></span><span> </span><span id="local-6989586621679710022"><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679710022"><span class="hs-identifier hs-var">ld</span></a></span></span><span> </span><span id="local-6989586621679710021"><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span></span><span> </span><span id="local-6989586621679710020"><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710020"><span class="hs-identifier hs-var">files</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-comment">-- Unlike &quot;ar&quot;, the &quot;ld&quot; tool is not designed to be used with xargs. That is,</span><span>
</span><span id="line-49"></span><span>  </span><span class="hs-comment">-- if we have more object files than fit on a single command line then we</span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-comment">-- have a slight problem. What we have to do is link files in batches into</span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-comment">-- a temp object file and then include that one in the next batch.</span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679710019"><span class="annot"><span class="annottext">simpleArgs :: [FilePath]
</span><a href="#local-6989586621679710019"><span class="hs-identifier hs-var hs-var">simpleArgs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;-r&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;-o&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span>      </span><span id="local-6989586621679710018"><span class="annot"><span class="annottext">initialArgs :: [FilePath]
</span><a href="#local-6989586621679710018"><span class="hs-identifier hs-var hs-var">initialArgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;-r&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;-o&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-56"></span><span>      </span><span id="local-6989586621679710017"><span class="annot"><span class="annottext">middleArgs :: [FilePath]
</span><a href="#local-6989586621679710017"><span class="hs-identifier hs-var hs-var">middleArgs</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;-r&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;-o&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710016"><span class="hs-identifier hs-var">tmpfile</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-57"></span><span>      </span><span id="local-6989586621679710015"><span class="annot"><span class="annottext">finalArgs :: [FilePath]
</span><a href="#local-6989586621679710015"><span class="hs-identifier hs-var hs-var">finalArgs</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710017"><span class="hs-identifier hs-var">middleArgs</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span>      </span><span id="local-6989586621679710014"><span class="annot"><span class="annottext">simple :: ProgramInvocation
</span><a href="#local-6989586621679710014"><span class="hs-identifier hs-var hs-var">simple</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [FilePath] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679710022"><span class="hs-identifier hs-var">ld</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710019"><span class="hs-identifier hs-var">simpleArgs</span></a></span><span>
</span><span id="line-60"></span><span>      </span><span id="local-6989586621679710013"><span class="annot"><span class="annottext">initial :: ProgramInvocation
</span><a href="#local-6989586621679710013"><span class="hs-identifier hs-var hs-var">initial</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [FilePath] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679710022"><span class="hs-identifier hs-var">ld</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710018"><span class="hs-identifier hs-var">initialArgs</span></a></span><span>
</span><span id="line-61"></span><span>      </span><span id="local-6989586621679710012"><span class="annot"><span class="annottext">middle :: ProgramInvocation
</span><a href="#local-6989586621679710012"><span class="hs-identifier hs-var hs-var">middle</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [FilePath] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679710022"><span class="hs-identifier hs-var">ld</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710017"><span class="hs-identifier hs-var">middleArgs</span></a></span><span>
</span><span id="line-62"></span><span>      </span><span id="local-6989586621679710011"><span class="annot"><span class="annottext">final :: ProgramInvocation
</span><a href="#local-6989586621679710011"><span class="hs-identifier hs-var hs-var">final</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [FilePath] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679710022"><span class="hs-identifier hs-var">ld</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710015"><span class="hs-identifier hs-var">finalArgs</span></a></span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span>      </span><span id="local-6989586621679710010"><span class="annot"><span class="annottext">targetDir :: FilePath
</span><a href="#local-6989586621679710010"><span class="hs-identifier hs-var hs-var">targetDir</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; FilePath
</span><a href="../../filepath/src/System.FilePath.Windows.html#takeDirectory"><span class="hs-identifier hs-var">takeDirectory</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>      </span><span class="annot"><a href="#local-6989586621679710009"><span class="hs-identifier hs-type">invokeWithResponesFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span>
</span><span id="line-67"></span><span>      </span><span id="local-6989586621679710009"><span class="annot"><span class="annottext">invokeWithResponesFile :: FilePath -&gt; ProgramInvocation
</span><a href="#local-6989586621679710009"><span class="hs-identifier hs-var hs-var">invokeWithResponesFile</span></a></span></span><span> </span><span id="local-6989586621679710008"><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710008"><span class="hs-identifier hs-var">atFile</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-68"></span><span>        </span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [FilePath] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679710022"><span class="hs-identifier hs-var">ld</span></a></span><span> </span><span class="annot"><span class="annottext">([FilePath] -&gt; ProgramInvocation)
-&gt; [FilePath] -&gt; ProgramInvocation
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710019"><span class="hs-identifier hs-var">simpleArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath] -&gt; [FilePath] -&gt; [FilePath]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'@'</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; FilePath -&gt; FilePath
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710008"><span class="hs-identifier hs-var">atFile</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span>      </span><span id="local-6989586621679710007"><span class="annot"><span class="annottext">oldVersionManualOverride :: Bool
</span><a href="#local-6989586621679710007"><span class="hs-identifier hs-var hs-var">oldVersionManualOverride</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-71"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; Flag Bool -&gt; Bool
forall a. a -&gt; Flag a -&gt; a
</span><a href="Distribution.Simple.Flag.html#fromFlagOrDefault"><span class="hs-identifier hs-var">fromFlagOrDefault</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">(Flag Bool -&gt; Bool) -&gt; Flag Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ConfigFlags -&gt; Flag Bool
</span><a href="Distribution.Simple.Setup.html#configUseResponseFiles"><span class="hs-identifier hs-var hs-var">configUseResponseFiles</span></a></span><span> </span><span class="annot"><span class="annottext">(ConfigFlags -&gt; Flag Bool) -&gt; ConfigFlags -&gt; Flag Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LocalBuildInfo -&gt; ConfigFlags
</span><a href="Distribution.Types.LocalBuildInfo.html#configFlags"><span class="hs-identifier hs-var hs-var">configFlags</span></a></span><span> </span><span class="annot"><span class="annottext">LocalBuildInfo
</span><a href="#local-6989586621679710023"><span class="hs-identifier hs-var">lbi</span></a></span><span>
</span><span id="line-72"></span><span>      </span><span class="hs-comment">-- Whether ghc's ar supports response files is a good proxy for</span><span>
</span><span id="line-73"></span><span>      </span><span class="hs-comment">-- whether ghc's ld supports them as well.</span><span>
</span><span id="line-74"></span><span>      </span><span id="local-6989586621679710005"><span class="annot"><span class="annottext">responseArgumentsNotSupported :: Bool
</span><a href="#local-6989586621679710005"><span class="hs-identifier hs-var hs-var">responseArgumentsNotSupported</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span>
</span><span id="line-75"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Compiler -&gt; Bool
</span><a href="Distribution.Simple.Compiler.html#arResponseFilesSupported"><span class="hs-identifier hs-var">arResponseFilesSupported</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LocalBuildInfo -&gt; Compiler
</span><a href="Distribution.Types.LocalBuildInfo.html#compiler"><span class="hs-identifier hs-var hs-var">compiler</span></a></span><span> </span><span class="annot"><span class="annottext">LocalBuildInfo
</span><a href="#local-6989586621679710023"><span class="hs-identifier hs-var">lbi</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679710007"><span class="hs-identifier hs-var">oldVersionManualOverride</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679710005"><span class="hs-identifier hs-var">responseArgumentsNotSupported</span></a></span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-keyword">then</span><span>
</span><span id="line-79"></span><span>      </span><span class="annot"><span class="annottext">[ProgramInvocation] -&gt; IO ()
</span><a href="#local-6989586621679710001"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="annot"><span class="annottext">([ProgramInvocation] -&gt; IO ()) -&gt; [ProgramInvocation] -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ProgramInvocation
-&gt; (ProgramInvocation, ProgramInvocation, ProgramInvocation)
-&gt; [FilePath]
-&gt; [ProgramInvocation]
</span><a href="Distribution.Simple.Program.Run.html#multiStageProgramInvocation"><span class="hs-identifier hs-var">multiStageProgramInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679710014"><span class="hs-identifier hs-var">simple</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679710013"><span class="hs-identifier hs-var">initial</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679710012"><span class="hs-identifier hs-var">middle</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679710011"><span class="hs-identifier hs-var">final</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710020"><span class="hs-identifier hs-var">files</span></a></span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-keyword">else</span><span>
</span><span id="line-81"></span><span>      </span><span class="annot"><span class="annottext">Verbosity
-&gt; TempFileOptions
-&gt; FilePath
-&gt; FilePath
-&gt; Maybe TextEncoding
-&gt; [FilePath]
-&gt; (FilePath -&gt; IO ())
-&gt; IO ()
forall a.
Verbosity
-&gt; TempFileOptions
-&gt; FilePath
-&gt; FilePath
-&gt; Maybe TextEncoding
-&gt; [FilePath]
-&gt; (FilePath -&gt; IO a)
-&gt; IO a
</span><a href="Distribution.Simple.Program.ResponseFile.html#withResponseFile"><span class="hs-identifier hs-var">withResponseFile</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679710024"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">TempFileOptions
</span><a href="Distribution.Simple.Utils.html#defaultTempFileOptions"><span class="hs-identifier hs-var">defaultTempFileOptions</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710010"><span class="hs-identifier hs-var">targetDir</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;ld.rsp&quot;</span></span><span> </span><span class="annot"><span class="annottext">Maybe TextEncoding
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">[FilePath]
</span><a href="#local-6989586621679710020"><span class="hs-identifier hs-var">files</span></a></span><span> </span><span class="annot"><span class="annottext">((FilePath -&gt; IO ()) -&gt; IO ()) -&gt; (FilePath -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-82"></span><span>        </span><span class="hs-glyph">\</span><span id="local-6989586621679710000"><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710000"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgramInvocation -&gt; IO ()
</span><a href="Distribution.Simple.Program.Run.html#runProgramInvocation"><span class="hs-identifier hs-var">runProgramInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679710024"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">(ProgramInvocation -&gt; IO ()) -&gt; ProgramInvocation -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; ProgramInvocation
</span><a href="#local-6989586621679710009"><span class="hs-identifier hs-var">invokeWithResponesFile</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710000"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-85"></span><span>    </span><span id="local-6989586621679710016"><span class="annot"><span class="annottext">tmpfile :: FilePath
</span><a href="#local-6989586621679710016"><span class="hs-identifier hs-var hs-var">tmpfile</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath -&gt; FilePath -&gt; FilePath
</span><a href="../../filepath/src/System.FilePath.Windows.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><span class="hs-string">&quot;tmp&quot;</span></span><span> </span><span class="hs-comment">-- perhaps should use a proper temp file</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><a href="#local-6989586621679710001"><span class="hs-identifier hs-type">run</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier hs-type">ProgramInvocation</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-88"></span><span>    </span><span id="local-6989586621679710001"><span class="annot"><span class="annottext">run :: [ProgramInvocation] -&gt; IO ()
</span><a href="#local-6989586621679710001"><span class="hs-identifier hs-var hs-var">run</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>    </span><span class="annot"><a href="#local-6989586621679710001"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="hs-special">[</span><span id="local-6989586621679709999"><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679709999"><span class="hs-identifier hs-var">inv</span></a></span></span><span class="hs-special">]</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgramInvocation -&gt; IO ()
</span><a href="Distribution.Simple.Program.Run.html#runProgramInvocation"><span class="hs-identifier hs-var">runProgramInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679710024"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679709999"><span class="hs-identifier hs-var">inv</span></a></span><span>
</span><span id="line-90"></span><span>    </span><span class="annot"><a href="#local-6989586621679710001"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679709998"><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679709998"><span class="hs-identifier hs-var">inv</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679709997"><span class="annot"><span class="annottext">[ProgramInvocation]
</span><a href="#local-6989586621679709997"><span class="hs-identifier hs-var">invs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgramInvocation -&gt; IO ()
</span><a href="Distribution.Simple.Program.Run.html#runProgramInvocation"><span class="hs-identifier hs-var">runProgramInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679710024"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">ProgramInvocation
</span><a href="#local-6989586621679709998"><span class="hs-identifier hs-var">inv</span></a></span><span>
</span><span id="line-91"></span><span>                        </span><span class="annot"><span class="annottext">FilePath -&gt; FilePath -&gt; IO ()
</span><a href="../../directory/src/System.Directory.html#renameFile"><span class="hs-identifier hs-var">renameFile</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710021"><span class="hs-identifier hs-var">target</span></a></span><span> </span><span class="annot"><span class="annottext">FilePath
</span><a href="#local-6989586621679710016"><span class="hs-identifier hs-var">tmpfile</span></a></span><span>
</span><span id="line-92"></span><span>                        </span><span class="annot"><span class="annottext">[ProgramInvocation] -&gt; IO ()
</span><a href="#local-6989586621679710001"><span class="hs-identifier hs-var">run</span></a></span><span> </span><span class="annot"><span class="annottext">[ProgramInvocation]
</span><a href="#local-6989586621679709997"><span class="hs-identifier hs-var">invs</span></a></span><span>
</span><span id="line-93"></span></pre></body></html>